home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / GFXFX2.ZIP / PALTEST.PAS < prev    next >
Pascal/Delphi Source File  |  1995-02-14  |  1KB  |  36 lines

  1.  
  2. program paltest; { PALTEST.PAS }
  3. { Simple demonstration of the pal-unit functions, by Bas van Gaalen }
  4. { Commandline-parameter: bots.pcx }
  5. uses u_vga,u_ffpcx,u_pal,u_kb;
  6. var pal,pal2:pal_type; pcxpic:pointer; i:byte;
  7. begin
  8.   getmem(pcxpic,320*200);
  9.   if pcx_load(paramstr(1),pcxpic,pal)<>pcx_ok then begin
  10.     writeln('An error ocured: ',pcx_errstr); halt; end;
  11.   move(pal,pal2,sizeof(pal)); { save original pal }
  12.   setvideo($13);
  13.   clearpal; { clear current palette }
  14.   displaypic(0,0,pcxpic,320,200); { place picture on screen (in black) }
  15.   freemem(pcxpic,320*200);
  16.   fadeup(pal); { fade-in to picture-colors }
  17.   waitkey(1);
  18.   for i:=0 to 255 do begin { init blue-scale pal }
  19.     pal[i].r:=i shr 4;
  20.     pal[i].g:=i shr 3;
  21.     pal[i].b:=i shr 2;
  22.   end;
  23.   fadepal(pal); { fade current pal to blue-scale pal }
  24.   waitkey(1);
  25.   repeat
  26.     vretrace; { cycle is interactive - add vertical retrace }
  27.     cyclepal(0,255,-1); { cycle through gray-scale pal }
  28.   until keypressed;
  29.   clearkeybuf;
  30.   fademax; { fade current pal to white }
  31.   waitkey(1);
  32.   fadepal(pal2); { fade through original color down to black }
  33.   fadedown;
  34.   setvideo(u_lm);
  35. end.
  36.